//Copyright (C) 2010 Phoenix. 

//This program is free software: you can redistribute it and/or modify 
//it under the terms of the GNU General Public License as published by 
//the Free Software Foundation, version 2.0. 

//This program is distributed in the hope that it will be useful, 
//but WITHOUT ANY WARRANTY; without even the implied warranty of 
//MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
//GNU General Public License 2.0 for more details. 

//A copy of the GPL 2.0 should have been included with the program. 
//If not, see http://www.gnu.org/licenses/ 

//Official SVN repository and contact information can be found at 
//http://code.google.com/p/ffcbeditor/


#ifndef __FFCBMainFrame__
#define __FFCBMainFrame__

/**
@file
Subclass of MainFrame, which is generated by wxFormBuilder.
*/

#include "FFCBFileDropHandler.h"
#include "cbgui.h"

#include "FFCBSingleFilePanel.h"
#include "FFCBTextArchivePanel.h"
#include "FFCBEEVBFilePanel.h"
#include "../common/common.h"


using namespace std;

/** Implementing MainFrame */
class FFCBMainFrame : public MainFrame, FFCBFileDropHandler
{
	DECLARE_EVENT_TABLE()
protected:
	// Handlers for MainFrame events.
	void OnExit( wxCloseEvent& event );
	void OnClickExit( wxCommandEvent& event );
	void OnClickOpen( wxCommandEvent& event );
	void OnClickFolder( wxCommandEvent& event );
	void OnClickFolderDb( wxCommandEvent& event );
	void OnAbout( wxCommandEvent& event );
	void OnItemClicked( wxTreeEvent& event );
	void OnItemRightClick( wxTreeEvent& event );
	void OnClickPreferences( wxCommandEvent& event );
	void OnBackup(wxCommandEvent& event);
	
	enum{
		wxID_BACKUP=2000
	};
	
public:
	/** Constructor */
	FFCBMainFrame( wxWindow* parent );
	
	virtual void HandleFileDrop(wxString&);
private:
	//my methods
	FileType CheckFileType(wxString& fileName);
	void CheckAndOpenFile(wxString& fileName);
	void OpenFile(wxString& fileName,FileType type);
	
	
	FFCBSingleFilePanel* singleFilePanel;
	FFCBTextArchivePanel* archivePanel;
	FFCBEEVBFilePanel* eevbPanel;
	wxMenu* backupMenu;
	wxTreeItemId selectedId;
};

#endif // __FFCBMainFrame__
